<%@ taglib uri="/WEB-INF/vectrics.tld" prefix="vectrics" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<%@ page import="org.vectrics.company.*" %>
<%@ page import="org.vectrics.provider.*" %>
<%@ page import="org.vectrics.*" %>
<%@ page import="org.vectrics.user.*" %>
<%@ page import="org.vectrics.provider.CoreServiceLocator" %>
<%@ page import="org.vectrics.struts.*" %>


<%
	Request vectricsRequest = HttpRequestConverter.convertRequest(request);
	String companyPersonId = request.getParameter("companyPersonId");
	if ((companyPersonId == null) || (companyPersonId.length() == 0)) {
		companyPersonId = (String)request.getAttribute("companyPersonId");		
	}
	if ((companyPersonId == null) || (companyPersonId.length() == 0)) {
		throw new SystemException("companyPersonId not specified as request attribute or parameter");
	}
	CompanyPerson companyPerson = CoreServiceLocator.getCompanyService().findCompanyPerson(new Long(companyPersonId));
	String companyId = companyPerson.getCompany().getId().toString();
	String domainId = companyPerson.getCompany().getDomain().getId().toString();
	String personId = companyPerson.getPerson().getId().toString();
	Person authPerson = CoreServiceLocator.getUserAuthService().getAuthorizedPerson(vectricsRequest);
%>

	<table>
		<tr>
			<td>
				<vectrics:companyPersonView companyPersonId="<%=companyPersonId%>" />
				<br>
				<vectrics:companyPersonRoleList companyPersonId="<%=companyPersonId%>" />
			</td>
			<td valign="top" align="right">
				<table cellpadding="1" cellspacing="1">
		<!--
					<tr>
						<td>
							<form action="/hrs-intranet/admin/company/person/role/edit.do" method="POST">
								<input type="hidden" name="companyPersonId" value="<%=companyPersonId%>">
								<input type="hidden" name="companyId" value="<%=companyId%>">
								<input type="hidden" name="domainId" value="<%=domainId%>">
								<input type="hidden" name="personId" value="<%=personId%>">
								<input type="hidden" name="roleTypeCode" value="emp">
								<vectrics:formButton code="button.param" phraseCode="button.company.person.role.add" 
									elementId="role.add.btn"
									value="submit" name="submit"/>
							</form>
						</td>
					</tr>
					<tr>
						<td>
							<form action="/hrs-intranet/admin/company/person/priv/edit.do" method="POST">
								<input type="hidden" name="companyPersonId" value="<%=companyPersonId%>">
								<input type="hidden" name="companyId" value="<%=companyId%>">
								<input type="hidden" name="domainId" value="<%=domainId%>">
								<input type="hidden" name="personId" value="<%=personId%>">
								<vectrics:formButton code="button.param" phraseCode="button.company.person.privs" value="submit" name="submit"/>
							</form>
						</td>
					</tr>
				-->
                    <tr>
                         <td valign="top" align="left" >
				            <form id="view_person" action="/hrs-intranet/admin/user/view.do" method="POST">
					           <input type="hidden" name="userId" value="<%=personId%>">
					            <input type="hidden" name="personId" value="<%=personId%>">
					            <vectrics:formButton elementId="view.person.btn" code="button.param" phraseCode="button.candidate.view.person" value="submit" name="submit"/>
				            </form>
			            </td>
                    </tr>
					<tr>
						<td>
							<form action="/hrs-intranet/admin/company/view.do" method="POST">
								<input type="hidden" name="companyId" value="<%=companyId%>">
								<vectrics:formButton code="button.param" phraseCode="button.company.view" 
									elementId="company.view.btn"
									value="submit" name="submit"/>
							</form>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
<br>
